﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/Styles/MyResources.xaml" />
        <ResourceDictionary Source="pack://application:,,,/Styles/ButtonStyles.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <SolidColorBrush x:Key="BorderBrushNormal" Color="#54545C"/>
    
    <Style x:Key="TileStyle1" TargetType="{x:Type controls:Tile}">
        <Setter Property="Width" Value="Auto"/>
        <Setter Property="Height" Value="Auto"/>
        <Setter Property="Margin" Value="3"/>
        <Setter Property="Foreground" Value="{Binding Foreground}"/>
        <Setter Property="FontFamily" Value="Segoe UI"/>
        <!--<Setter Property="Background" Value="{DynamicResource AccentColorBrush}"/>-->
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:Tile}">
                    <Border BorderThickness="1" BorderBrush="{StaticResource BorderBrushNormal}">
                        <Grid Background="{TemplateBinding Background}">
                            <StackPanel HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Orientation="Vertical" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                                <Border BorderBrush="White" BorderThickness="0,0,0,2">
                                    <Grid Background="{DynamicResource AccentColorBrush}">
                                        <Label Grid.ColumnSpan="2" Foreground="{TemplateBinding Foreground}" HorizontalAlignment="Left" VerticalAlignment="Bottom">
                                            <AccessText Foreground="{TemplateBinding Foreground}" FontSize="16" Margin="3" TextWrapping="Wrap" Text="{Binding Title, RelativeSource={RelativeSource TemplatedParent}}"/>
                                        </Label>
                                        <Button Name="OmgThereSAButtonOverHere" Height="24" HorizontalAlignment="Right" VerticalAlignment="Top">
                                            <Image Source="{StaticResource CloseImageDark}" Stretch="Uniform"></Image>
                                        </Button>
                                    </Grid>
                                </Border>
                                <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" RecognizesAccessKey="True"/>
                            </StackPanel>
                        </Grid>
                    </Border>
                    <!--<ControlTemplate.Triggers>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="RenderTransform">
                                <Setter.Value>
                                    <ScaleTransform CenterY="0.5" CenterX="0.5" ScaleY="0.98" ScaleX="0.98"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>-->
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="PanoramaDevControl" TargetType="UserControl">
        <Setter Property="Width" Value="Auto"/>
        <Setter Property="Height" Value="Auto"/>
        <Setter Property="Margin" Value="3"/>
        <Setter Property="Foreground" Value="{Binding Foreground}"/>
        <Setter Property="FontFamily" Value="Segoe UI"/>
        <!--<Setter Property="Background" Value="{DynamicResource AccentColorBrush}"/>-->
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type UserControl}">
                    <Border BorderThickness="1" BorderBrush="{StaticResource BorderBrushNormal}" SnapsToDevicePixels="True" HorizontalAlignment="Stretch">
                        <StackPanel HorizontalAlignment="Stretch" Orientation="Vertical" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <Border BorderBrush="White" BorderThickness="0,0,0,1">
                                <Grid Background="{DynamicResource AccentColorBrush}">
                                    <Label Foreground="{TemplateBinding Foreground}" HorizontalAlignment="Left" VerticalAlignment="Bottom">
                                        <AccessText Foreground="{TemplateBinding Foreground}" FontSize="16" Margin="3" TextWrapping="Wrap" Text="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}"/>
                                    </Label>
                                    <Button Name="OmgThereSAButtonOverHere" Height="28" HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource ToolBarButton}">
                                        <Image Source="{StaticResource CloseImageDark}" Stretch="Uniform"/>
                                    </Button>
                                </Grid>
                            </Border>
                            <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" RecognizesAccessKey="True"/>
                        </StackPanel>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>